import request from '@/utils/http/index.ts';

/**
 * 查询菜单列表
 * @param params
 * @returns
 */
export const getMenuList = (params?: any) => request.get('/menu/list', { params });

/**
 * 新增菜单
 * @param data
 * @returns
 */
export const addMenu = (data: any) => request.post('/menu', data);

/**
 * 修改菜单
 * @param data
 * @returns
 */
export const updateMenu = (data: any) => request.put('/menu', data);

/**
 * 删除菜单
 * @param menuId
 * @returns
 * */
export const deleteMenu = (menuId: number) => request.delete(`/menu/${menuId}`);

/**
 * 查询菜单树
 * @param params
 * @returns
 */
export const getMenuTree = (params?: any) => request.get('/menu/treeselect', { params });

/**
 * 获取角色菜单树，其中包含选中的menuIds
 * @param roleId
 * @returns
 */
export const getRoleMenuTree = (roleId: number) =>
  request.get(`/menu/roleMenuTreeselect/${roleId}`);
